package org.jeecg.modules.user.version.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.system.upgrade.entity.BikeUpgradeAppUpgrade;
import org.jeecg.modules.user.version.service.VersionService;
import org.jeecg.modules.utils.BikeResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags="app版本升级")
@RestController
@RequestMapping("/app/upgrade")
@Slf4j
public class VersionController {

    @Autowired
    private VersionService versionService;


    @ApiOperation(value="app升级", notes="app升级")
    @RequestMapping(value = "/getNewVersion", method = RequestMethod.GET)
    public BikeResult getNewVersion(@RequestParam("appId") String appId) {
        return versionService.getNewVersion(appId);
    }

    @ApiOperation(value="app升级统计", notes="app升级统计")
    @RequestMapping(value = "/insertUpgrade", method = RequestMethod.POST)
    public BikeResult insertUpgrade(@RequestBody BikeUpgradeAppUpgrade bikeUpgradeAppUpgrade) {
        return versionService.insertUpgrade(bikeUpgradeAppUpgrade);
    }
}
